FIG. 1 is an embodiment depicting a video processing system. In FIG. 1, a video processing system 100 utilizes an encoder 200 and a decoder 110. The encoder 200 receives video data 120. The encoder 200 encodes in a predetermined format encoded data 130. The decoder 110 receives the encoded data 130 and decodes it according to the predetermined format to produce decoded data 140. The decoder has to properly identify the beginning of each bitstream. The encoder utilizes an identifier to highlight the beginning of the bitstream to the decoder. However, sometimes, the identifier may accidentally exist in the encoded stream where it is not the beginning of the stream.
For example, at the encoder, an existing method of emulation byte prevention (EPB) insertion is used to detect this identifier within the stream and replace it with an alternative pattern. At the decoder, once the beginning of the stream is detected, EPB removal is performed on the rest of the stream. When the syntax elements that are to be encoded into the bitstream is generated in the same order that they are to be signaled in the bitstream, EPB insertion at the encoder may be done on the fly as the bitstream is being generated. This enables low latency encoding, since there is no additional delay of performing EPB insertion. However, when the syntax elements that is to be encoded into the bitstream are not generated in the same order that they area signaled in the bitstream, for instance, when syntax elements generated from step 2 are inserted before syntax elements generated from step 1 in the bitstream. , EPB cannot be done of the fly without potentially causing the identifier to appear at the transition point between bits from step 1 and 2.
Therefore, there is a need for an improved method and apparatus that prevents the encoder from misleading the decoder and that assists the decoder to correctly identify beginning of a bitstream